import urllib
import urllib2
import function
import ujson


game_data= {'account':'ceshi01','password':'123','icon':'01','agent_account':'a'}
#game_data=  {834946: {23: {'user_infos': {1: {'is_master': 1, 'gain_goldpoint': -20, 'bet_places': {'02': 60, '08': 70}}, 2: {'is_master': 0, 'gain_goldpoint': 10, 'bet_places': {'02':30,'09':40}}}, 'table_infos': {'master_fee': 0, 'table_fee': 10, 'profit_fee': 0}}}}
#test_data = {'data': ujson.dumps(game_data)}
#test_data = ujson.dumps(game_data)
#test_sing=function.set_sign(test_data
test_sing=function.set_sign(game_data)
game_data['sign']=test_sing
# game_data = {'uid':30,'type':1,'old_pwd':456,'new_pwd':123,'again_pwd':1234}
test_data_urlencode = urllib.urlencode(game_data)

#requrl = "http://127.0.0.1:8000/lottory/dec_goldpoint"
requrl = "http://127.0.0.1:8000/api/lottory/register"
req = urllib2.Request(url = requrl,data =test_data_urlencode)

res_data = urllib2.urlopen(req)
res = res_data.read()
print res